package com.rising.spring.main;

import java.util.Hashtable;
import java.util.TreeMap;

public class BaseTest1 {
    public static void main(String[] args) {
        TreeMap<String, String> treeMap = new TreeMap<>();
        treeMap.put("A", null);
        System.out.println("A=" + treeMap.get("A"));
        treeMap.put("A", "2");
        System.out.println("A=" + treeMap.get("A"));
        treeMap.put("B", null);
        Hashtable<String, Object> hashtable = new Hashtable<>();
        try {
            hashtable.put("a", null);
        } catch (Exception e) {
            System.out.println("hashtable的值不可以为空：" + e.getMessage());
            e.printStackTrace();
        }

        try {
            hashtable.put(null, "A");
        } catch (Exception e) {
            System.out.println("hashtable的key不可以为空：" + e.getMessage());
            e.printStackTrace();
        }
    }
}
